/**
 * Copyright (c) 2016-2019 九点科技 All rights reserved.
 *
 * http://www.9dyun.cn
 *
 * 版权所有，侵权必究！
 */
package com.dian.modules.sale.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dian.common.utils.ListUtils;
import com.dian.common.utils.MapUtils;
import com.dian.modules.sale.dao.ProbLineDao;
import com.dian.modules.sale.entity.ProbHeadEntity;
import com.dian.modules.sale.entity.ProbLineEntity;
import com.dian.modules.sale.service.ProbLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 预订单明细服务实现类
 *
 * @author xiaolai
 * @email xiaolai@9dyun.cn
 * @date 2019-06-10 23:04:30
 */
@Service("ProbLineService")
public class ProbLineServiceImpl extends ServiceImpl<ProbLineDao, ProbLineEntity> implements ProbLineService {
    @Autowired
    public ProbLineService probLineService;

    @Override
    public boolean updateInfo(ProbHeadEntity probHeadEntity) {
        List<ProbLineEntity> lineList=probHeadEntity.getProbLineEntityList();
        this.removeByMap(new MapUtils().put("prob_id", probHeadEntity.getId()));
        this.saveBatch(lineList);
        return true;

    }

    @Override
    public boolean deleteInfo(Long id) {
        return this.remove(new QueryWrapper<ProbLineEntity>().eq("prob_id",id));

    }

    @Override
    public List<ProbLineEntity> queryLineList(Long id) {
        return this.list(new QueryWrapper<ProbLineEntity>().eq("prob_id",id));

    }

}
